package com.kaifamiao.poker;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Poker {

	// 卡牌
	private final List<String> CARDS = new ArrayList<String>();
	// 默认游戏人数
	private final static int DEFAULT_PLAYER_COUNT = 12;
	
	// 神
	private static final List<String> SM = List.of("预言家", "女巫", "猎人", "白痴");
	// 狼人
	private static final List<String> LR = List.of("狼人");
	// 村民
	private static final String CM = "村民";
	
	
	public Poker() {
		this(DEFAULT_PLAYER_COUNT);
	}
	
	public Poker(int count) {
		if (count > 12) count = 12;
		int avg = count / 3; // 平均人数
		for (int i = 0; i < avg; i++) {
			CARDS.add(SM.get(i));
			CARDS.add(LR.get(0));
		}
		int curr = CARDS.size();
		for (int i = 0; i < count - curr; i++) {
			CARDS.add(CM);
		}
	}
	
	
	// 发牌
	public List<String> deal() {
		return deal(3);
	}
	
	public List<String> deal(int count) {
		for (int i = 0; i < count; i++) {
			Collections.shuffle(CARDS);
		}
		return CARDS;
	}
	
	public static void main(String[] args) {
		System.out.println(new Poker().deal());
	}
}
